package com.codedef;

import com.codedef.service.InitBloomService;
import com.codedef.util.SpringUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ApplicationContext;


@EnableDiscoveryClient
@SpringBootApplication
@EnableFeignClients
public class SeatreservationApplication {



    public static void main(String[] args) {
        SpringApplication.run(SeatreservationApplication.class, args);

        init();
    }

    /**
     * 初始化工作
     */
    public static void init() {
        // 拿到Spring的Context
        ApplicationContext applicationContext = SpringUtil.getApplicationContext();
        InitBloomService initService = applicationContext.getBean(InitBloomService.class);
        // 初始化Redis中的布隆过滤器
        initService.initSeatListBloomCache();
    }

}
